package vsqlbuilder.logic.sql;

import vsqlbuilder.Utils.kindofJoin;
import vsqlbuilder.logic.Column;

public class QueryJoin {
	private Column sourceColumn;
	private Column destinationTable;

	private kindofJoin typeJoin;
	
	//Not use QueryColumn because a column in a relation join can be a not selected one, maybe.
	public QueryJoin(Column source, Column destination){
		this.sourceColumn=source;
		this.destinationTable=destination;
		//TODO [urgent]: fix this BIG BIG BIG bug
		this.typeJoin=kindofJoin.EQUAL;
	}
	
	public String getSourceTableName(){
		return this.sourceColumn.getParentTable().getName();
	}
	
	public String getDestinationTableName(){
		return this.destinationTable.getParentTable().getName();
	}
	
	public String getSourceSchemaName(){
		return this.sourceColumn.getParentTable().getSchemaName();
	}
	
	public String getDestinationSchemaName(){
		return this.destinationTable.getParentTable().getSchemaName();
	}

	public String getSourceColumnName(){
		return this.sourceColumn.getName();
	}
	
	public String getDestinationColumnName(){
		return this.destinationTable.getName();
	}
	
	
	public kindofJoin getKindOfJoin(){
		return this.typeJoin;
	}
	
	public void setTypeOfJoin(kindofJoin k){
		this.typeJoin=k;
	}
	
	public String getJoinSymbol(){
		switch(typeJoin){
		case EQUAL:
			return "=";
		default:
			return "BadSymbolOfJoin";
		}
	}
	
}
